/*
 * ActionContribution.java
 *
 * Created on 6 de Dezembro de 2007, 19:09
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.ontoscheduler.concepts;

import java.util.Collection;

import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.rdf.model.Literal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;

/**
 *
 * @author joaoolavo
 */
public class ActionContribution extends Concepts {
    
    /** Creates a new instance of ActionContribution */
    public ActionContribution(OntModel m) {
        setConcept(m, "ActionContribution");
    }
    
    public int setBeginTime(Individual ac, Date b){
        Collection col = new ArrayList();
        col.add(b);
        return addPropertyValues("begin", ac, col, DATATYPE_PROPERTY);
    }

    public int setEndTime(Individual ac, Date e){
        Collection col = new ArrayList();
        col.add(e);
        return addPropertyValues("end", ac, col, DATATYPE_PROPERTY);
    }
    
    public Date getBeginTime(Individual ac){ 
        Iterator beginValue = getPropertyValues("begin", ac);
        Literal b = (Literal) beginValue.next();
        return (Date) b.getValue();
    }
    
    public Date getEndTime(Individual ac){ 
        Iterator endValue = getPropertyValues("end", ac);
        Literal e = (Literal) endValue.next();
        return (Date) e.getValue();        
    }
    
    public int setIntentionalMomment(Individual ac, Collection im){
        return addPropertyValues("causedBy", ac, im, OBJECT_PROPERTY);
    }
    
    public int setIntanceOf(Individual ac, Collection au){
        return addPropertyValues("instanceOf", ac, au, OBJECT_PROPERTY);
    }

    public int setAgent(Individual ac, Collection a){
        return addPropertyValues("performanceOf", ac, a, OBJECT_PROPERTY);
    }
}
